home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Disc to the Future 2
/
Disc to the Future Part II Programmer's Reference (Wayzata Technology)(6013)(1992).bin
/
MAC
/
THINKC
/
3_0
/
CUTILSLI
/
UTILITYL
/
TSTBIT.C
< prev
next >
Wrap
Text File
|
1987-11-10
|
1KB
|
61 lines
/****************************************
* File: TstBit.c
* Purpose: To Test a given bit
* in a variable.
* Authors: Robert E. Neville
* Date: 11/10/87
* Procedures: ClrBit().
* Version: 1.0a
* Copyright: Hummingbird Graphics
*****************************************/
/*
Note:
The defines below are the bit locations.
Notice that they are reversed. It would
be better to use these instead. If you
wanted to use a char or a long for your
variable the largest BIT (ie. BIT8 or
BIT32) would be 0x0 and you count larger
as you go down to BIT1 (0x8, or 0x1F)
Get it?
*/
/* Paste these into your header file
#define BIT1 0xF
#define BIT2 0xE
#define BIT3 0xD
#define BIT4 0xC
#define BIT5 0xB
#define BIT6 0xA
#define BIT7 0x9
#define BIT8 0x8
#define BIT9 0x7
#define BIT10 0x6
#define BIT11 0x5
#define BIT12 0x4
#define BIT13 0x3
#define BIT14 0x2
#define BIT15 0x1
#define BIT16 0x0
*/
/****************************************
* File: TstBit(ptr,bitNum)
* Purpose: To Test a given bit
* in a variable.
* Passed: char * - ptr to var
* short - bitNum to test
* Returned: char - TRUE or FALSE
*****************************************/
char TstBit(ptr,bitNum)
char * ptr;
short bitNum;
{
return (BitTst(ptr,bitNum));
}
/********** End of File **********/